package com.rui.common.util;

import lombok.Getter;

import java.io.Serializable;

/**
 * 常量类
 *
 * @author xr
 * @email xr@qq.com
 * @date 2020-01-01 00:00:00
 */
public class Const implements Serializable {
    public enum status {
        /**
         * 正常
         **/
        enable(0, "正常"),
        /**
         * 禁用
         **/
        disable(1, "禁用");

        status(Integer key, String value) {
            this.key = key;
            this.value = value;
        }

        @Getter
        private final Integer key;
        @Getter
        private final String value;

        public static String value(Integer key) {
            for (status e : values()) {
                if (e.getKey().equals(key)) {
                    return e.getValue();
                }
            }
            return null;
        }
    }

    public enum sex {
        /**
         * 正常
         **/
        woman(0, "女"),
        /**
         * 禁用
         **/
        man(1, "男");

        sex(Integer key, String value) {
            this.key = key;
            this.value = value;
        }

        @Getter
        private final Integer key;
        @Getter
        private final String value;

        public static String value(Integer key) {
            for (sex e : values()) {
                if (e.getKey().equals(key)) {
                    return e.getValue();
                }
            }
            return null;
        }
    }
}
